<?php

/**
 * DoctorBilling filter form base class.
 *
 * @package    docplus.co.za
 * @subpackage filter
 * @author     Fox Matuku
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseDoctorBillingFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'doctor_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Doctor'), 'add_empty' => true)),
      'frequency'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'Monthly' => 'Monthly', 'Biannually' => 'Biannually', 'Annually' => 'Annually', 'Never' => 'Never'))),
      'type'              => new sfWidgetFormChoice(array('choices' => array('' => '', 'Direct deposit' => 'Direct deposit', 'EFT' => 'EFT', 'Credit card' => 'Credit card', 'Debit order' => 'Debit order', 'Free' => 'Free'))),
      'amount'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'last_billing_date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'next_billing_date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'admin_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Admin'), 'add_empty' => true)),
      'created_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'doctor_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Doctor'), 'column' => 'id')),
      'frequency'         => new sfValidatorChoice(array('required' => false, 'choices' => array('Monthly' => 'Monthly', 'Biannually' => 'Biannually', 'Annually' => 'Annually', 'Never' => 'Never'))),
      'type'              => new sfValidatorChoice(array('required' => false, 'choices' => array('Direct deposit' => 'Direct deposit', 'EFT' => 'EFT', 'Credit card' => 'Credit card', 'Debit order' => 'Debit order', 'Free' => 'Free'))),
      'amount'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'last_billing_date' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'next_billing_date' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'admin_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Admin'), 'column' => 'id')),
      'created_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('doctor_billing_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DoctorBilling';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'doctor_id'         => 'ForeignKey',
      'frequency'         => 'Enum',
      'type'              => 'Enum',
      'amount'            => 'Number',
      'last_billing_date' => 'Date',
      'next_billing_date' => 'Date',
      'admin_id'          => 'ForeignKey',
      'created_at'        => 'Date',
      'updated_at'        => 'Date',
    );
  }
}
